// 导入自己封装好的axios请求工具
import {httpInstance} from "@/utils/http.js";

//生成并获取密钥
export function adminGetAdminkey(setUpInfo) {
    const {num, classes, date} = setUpInfo;
    // 调用自己封装好的工具把参数传入之后再axios工具中就会帮我们请求数据
    return httpInstance({
        url: "/admin/get_key",
        method: "put",
        data: {
            num: num,
            classes: classes,
            date: date
        }
    })
}

// 生成值班表
export function adminProduceRota(key) {
    return httpInstance({
        url: "/admin/produce_rota",
        method: "post",
        headers: {
            key: key
        }
    })
}

// 修改值班表
export function adminUpdateRota(key,rota) {
    return httpInstance({
        url: "/admin/update_rota",
        method: "put",
        headers: {
            key: key
        },
        data: {
            rota
        }
    })
}

// 获取用户课程表
export function adminGetUserTable(userId) {
    return httpInstance({
        url: "/admin/get_user_table",
        method: "get",
        headers: {
            key: userId
        }
    })
}

// 删除用户课程表
export function adminDeleteUserTable(userId, submitId) {
    return httpInstance({
        url: "/admin/del_user_table",
        method: "delete",
        headers: {
            key: userId,
            submitId: submitId
        }
    })
}
